package com.hzit.controller;

import com.hzit.common.util.R;
import com.hzit.service.IUserService;
import com.hzit.vo.UserVo;
import jdk.nashorn.internal.objects.annotations.Getter;
import net.bytebuddy.asm.Advice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wf
 * @since 2024-01-25
 */
@RestController
@RequestMapping("/user")
public class UserController {

	@Autowired
	private IUserService userService;

	//1. 用户登录
	@PostMapping("/login")
	public Map<String,Object> login(@RequestBody UserVo vo){
		Map<String,Object> resultMap = userService.login(vo);
		return resultMap;
	}
	//2. 用户列表
	@GetMapping("/list")
	public R findAll(){
		return R.ok(userService.list());
	}
}
